{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "An image filter for anisotropic diffusion smoothing (i.e., edge preserving). The options are"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "usage: medpy_anisotropic_diffusion.py [-h] [-i ITERATIONS] [-k KAPPA]\n",
      "                                      [-g GAMMA] [-v] [-d] [-f]\n",
      "                                      input output\n",
      "\n",
      "Executes gradient anisotropic diffusion filter over an image. This smoothing\n",
      "algorithm is edges preserving. Note that the images voxel-spacing will be\n",
      "taken into account. Copyright (C) 2013 Oskar Maier This program comes with\n",
      "ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to\n",
      "redistribute it under certain conditions; see the LICENSE file or\n",
      "<http://www.gnu.org/licenses/> for details.\n",
      "\n",
      "positional arguments:\n",
      "  input                 Source volume.\n",
      "  output                Target volume.\n",
      "\n",
      "optional arguments:\n",
      "  -h, --help            show this help message and exit\n",
      "  -i ITERATIONS, --iterations ITERATIONS\n",
      "                        The number of smoothing iterations. Strong parameter.\n",
      "  -k KAPPA, --kappa KAPPA\n",
      "                        The algorithms kappa parameter. The higher the more\n",
      "                        edges are smoothed over.\n",
      "  -g GAMMA, --gamma GAMMA\n",
      "                        The algorithms gamma parameter. The higher, the\n",
      "                        stronger the plateaus between edges are smeared.\n",
      "  -v                    Display more information.\n",
      "  -d                    Display debug information.\n",
      "  -f                    Silently override existing output images.\n"
     ]
    }
   ],
   "source": [
    "medpy_anisotropic_diffusion.py -h"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's pick some unrealisitc high values and run the script on our test image."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "medpy_anisotropic_diffusion.py -i100 -f -k100 -g100 resources/flair.nii.gz output/anisotropic_diffusion.nii.gz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The original image:\n",
    "![The original image](images/flair.png)\n",
    "\n",
    "The processed image\n",
    "![The processed image](images/anisotropic_diffusion.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Bash",
   "language": "bash",
   "name": "bash"
  },
  "language_info": {
   "codemirror_mode": "shell",
   "file_extension": ".sh",
   "mimetype": "text/x-sh",
   "name": "bash"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
